package com.chenchao.thread;

/**
 * @encoding : UTF-8
 * @Time : 2020/11/17 19:48
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.javathread.Test12.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 * 线程合并
 */
public class Test12 implements Runnable{
    public static void main(String[] args) throws InterruptedException {
        Thread thread1 = new Thread(new Test12(), "Vip线程");
        thread1.start();
        int i=0;
        while (i<1000){
            if(i==100){
                thread1.join();//开启的线程才能插队
            }
            System.out.println(Thread.currentThread().getName()+i+"次");
            i++;
        }
    }

    @Override
    public void run() {
        int i=0;
        while (i<1000){
            System.out.println(Thread.currentThread().getName()+i+"次");
            i++;
        }

    }
}
